t = int(input())
for _ in range(t):
n, m = map(int, input().split())
s = input()
p = list(map(int, input().split()))
mp = [0] * n
for value in p:
mp[value - 1] += 1
for i in range(n - 1, 0, -1):
mp[i - 1] += mp[i]
occ = [0] * 26
for i in range(len(s)):
occ[ord(s[i]) - ord('a')] += mp[i]
occ[ord(s[i]) - ord('a')] += 1
print(' '.join(list(map(str, occ))))
/* !_
|*~=-.,
|_,-'`
|
|
/^\
!_ / \
|*`~-., /, \
|.-~^` /#" \
| _/##_ _ \_
_ _| _ _ _ [ ]_[ ]_[ ]_[ ]
[ ]_[ ]_[ ]_[ ]_[ ] |_=_-=_ - =_|
!_ |_=_ =-_-_ = =_| !_ |=_= - |
|*`--,_- _ | |*`~-.,= [] |
|.-'|= [] | !_ |_.-"`_- |
| |_=- - | |*`~-., | |=_- |
/^\ |=_= - | |_,-~` /^\ |_ - =[] |
_ / \_|_=- _ _ _| _| _ / \|=_- |
[ ]/, \[ ]_[ ]_[ ]_[ ]_[ ]_[ ]_/, \[ ]=- |
|/#" \_=-___=__=__- =-_ -=_ /#" \| _ [] |
_/##_ _ \_-_ = _____ _/##_ _ \_ - |\
[ ]_[ ]_[ ]_[ ]=_0~{_ _ _}~0 [ ]_[ ]_[ ]_[ ]=- | \
|_=__-_=-_ =_|-=_ | , | |_=-___-_ =-__|_ | \
| _- =- |-_ | ((* | |= _= | - |___\
|= -_= |= _ | ` | |_-=_ |=_ |/+\|
| =_ - |_ = _ `-.-` | =_ = = |=_- ||+||
|-_=- _ |=_ = |=_= -_ | = ||+||
|=_- /+\ | -= |_=- /+\ |=_ |^^^|
|=_ |+|+| |= - -_,--,_ |_= |+|+| | -_ |= |
| -|+|+| |-_= / | | \ |=_ |+|+| |-=_ |_-/
|=_=|+|+| | =_= | | | | |_- |+|+| |_ = |=/
| _ ^^^^^ |= - | | <&> |=_=^^^^^ |_=- |/
|=_ = | =_-_| | | | | =_ | -_ |
|_=-_ |=_= | | | | |=_= |=- |
^^^^^^^^^^`^`^^`^`^`^^^""""""""^`^^``^^`^^`^^`^`^``^`^``^``^^
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
#define ll long long
#define ld long double
#define vi vector<int>
#define vll vector<long long>
#define pii pair<int,int>
#define gcd __gcd
#define S string
#define inf INT_MAX
#define minf INT_MIN
#define lmax LLONG_MAX
#define pb push_back
#define ff first
#define ss second
#define FAST ios_base::sync_with_stdio(false);
#define FAST_INPUT cin.tie(0);
#define FAST_OUTPUT cout.tie(0);
#define w(t) int t; cin>>t; while(t--)
#define f(i,a,n) for(long long int i=a;i<n;i++)
#define g(i,a,n) for(long long int i=a;i>=n;i--)
#define odd(n) (n&1)
#define endl "\n"
#define all(x) x.begin(),x.end()
#define yes() cout<<"YES"<<endl
#define no() cout<<"NO"<<endl
#define no1() cout<<-1<<endl
const int N=1e6+10;
#define Mod 1000000007
#define mod 998244353
ll factorial(ll n)
{
ll answer=1;
while(n--)
{
answer*=n+1;
answer%=Mod;
}
return answer;
}
ll power(ll a,ll b)
{
if(b==0)
return 1;
ll res=power(a,b/2);
if(odd(b))
{
return (a*res%Mod*res%Mod)%Mod;
}
else
{
return (res%Mod*res%Mod)%Mod;
}
}
ll modulo_inverse(ll n)
{
return power(n,Mod-2);
}
ll ncr(ll n,ll r)
{
if (r==0 || n==0)
{
return 1;
}
ll fac[n+1];
fac[0]=1;
f(i,1,n+1)
{
fac[i]=(fac[i-1]*i)%Mod;
}
return (fac[n]*modulo_inverse(fac[r])%Mod*modulo_inverse(fac[n-r])%Mod)%Mod;
}
void dis(vll v)
{
f(i,0,v.size())
{
cout<<v[i]<<" ";
}
}
ll digits(ll n)
{
ll ct=0;
while(n)
{
ct++;
n/=10;
}
return ct;
}
ll b_digits(ll n)
{
ll ct=0;
while(n)
{
ct++;
n/=2;
}
return ct;
}
int main()
{
int t;
cin>>t;
while(t--)
{
ll n,k;
cin>>n>>k;
string s;
cin>>s;
vll v;
map<ll,ll> m;
f(i,0,k)
{
ll x;
cin>>x;
v.pb(x);
}
f(i,0,n)
{
m[s[i]-'a']++;
}
ll a[n][26];
f(i,0,n)
{
f(j,0,26)
{
a[i][j]=0;
}
}
a[0][s[0]-'a']++;
f(i,1,n)
{
a[i][s[i]-'a']++;
f(j,0,26)
{
a[i][j]+=a[i-1][j];
}
}
ll arr[26]={0};
f(i,0,k)
{
f(j,0,26)
{
arr[j]+=(a[v[i]-1][j]);
}
}
f(i,0,26)
{
cout<<arr[i]+m[i]<<" ";
}
cout<<endl;
}
}
1517A - Sum of 2050 | 620A - Professor GukiZ's Robot |
1342A - Road To Zero | 1520A - Do Not Be Distracted |
352A - Jeff and Digits | 1327A - Sum of Odd Integers |
1276A - As Simple as One and Two | 812C - Sagheer and Nubian Market |
272A - Dima and Friends | 1352C - K-th Not Divisible by n |
545C - Woodcutters | 1528B - Kavi on Pairing Duty |
339B - Xenia and Ringroad | 189A - Cut Ribbon |
1182A - Filling Shapes | 82A - Double Cola |
45A - Codecraft III | 1242A - Tile Painting |
1663E - Are You Safe | 1663D - Is it rated - 3 |
1311A - Add Odd or Subtract Even | 977F - Consecutive Subsequence |
939A - Love Triangle | 755A - PolandBall and Hypothesis |
760B - Frodo and pillows | 1006A - Adjacent Replacements |
1195C - Basketball Exercise | 1206A - Choose Two Numbers |
1438B - Valerii Against Everyone | 822A - I'm bored with life |